<extend name="Base/common"/>
<block name="body">
  <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
  
  <ul class="tab-nav nav">
    <li class="current"> <a href="#">{:isset($info['id'])?'编辑':'新增'}分类<span class="arrow fa fa-sort-up"></span> </a> </li>
    </volist>
  </ul>
  <div class="tab-wrap">
    <div class="tab-content">
      <form action="{:U()}" method="post" class="form-horizontal">
        <!-- 基础 -->
        <div id="tab1" class="tab-pane in tab1">
        <div class="form-item">
          <label class="item-label">上级分类:<span class="check-tips">{$category['title']|default='无'}</span></label>
        </div>
        <div class="form-item">
          <label class="item-label"> 分类名称<span class="check-tips">（名称不能为空）</span> </label>
          <div class="controls">
            <input type="text" name="title" class="text input-large" value="{$info.title|default=''}">
          </div>
        </div>
        <div class="form-item">
          <label class="item-label"> 排序<span class="check-tips">（仅对当前层级分类有效）</span> </label>
          <div class="controls">
            <input type="text" name="sort" class="text input-small" value="{$info.sort|default=0}">
          </div>
        </div>
        <notempty name="group.has_admin">
        <div class="form-item">
          <label class="item-label"> 管理员<span class="check-tips">（这里输入管理员的ID）</span> </label>
          <div class="controls">
            <input type="text" name="admin_uids" class="text input-large" value="{$info.admin_uids|default=''}">
          </div>
        </div>
        </notempty>
        <div class="form-item mt10">
          <input type="hidden" name="id" value="{$info.id|default=''}">
          <input type="hidden" name="pid" value="{:isset($category['id'])?$category['id']:$info['pid']}">
          <button type="submit" id="submit" class="btn submit-btn ajax-post mr10" target-form="form-horizontal">确 定</button>
          <button class="btn btn-yellow submit-btn" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
      </form>
    </div>
  </div>
</block>
<block name="script">
  <script type="text/javascript">
		<present name="info.id">
		Think.setValue("allow_publish", {$info.allow_publish|default=1});
		Think.setValue("check", {$info.check|default=0});
		Think.setValue("model[]", {$info.model|json_encode} || [1]);
		Think.setValue("type[]", {$info.type|json_encode} || [2]);
		Think.setValue("display", {$info.display|default=1});
		Think.setValue("reply", {$info.reply|default=0});
		Think.setValue("reply_model[]", {$info.reply_model|json_encode} || [1]);
		</present>
		$(function(){
			showTab();
			$("input[name=reply]").change(function(){
				var $reply = $(".form-item.reply");
				parseInt(this.value) ? $reply.show() : $reply.hide();
			}).filter(":checked").change();
		});
		//导航高亮
		$('.side-sub-menu').find('a[href="{:U('Category/index')}"]').closest('li').addClass('current');
	</script>
</block>
